<?php $this->load->view('header');?>

<div class="page-container">
    <?php $this->load->view('sidebar');?>
    <!-- BEGIN CONTENT -->
    <div class="page-content-wrapper">
        <div class="page-content">
        <?php $this->load->view('sale/_sub_nav');?>
            <div class="row">
                <div class="col-md-12">
                <?php if(isset($message)&&!empty($message)):?>
                <?php $this->load->view('alert_message',$message);?>
                <?php endif;?> 

                    <div class="admin-box">
                        <?php echo form_open($this->uri->uri_string(), array('class'=>'form-horizontal','role'=>'form')); ?>
                        <div class="form-body">
                            <h3 class="form-section"><?php echo lang('clue_basic_info'); ?></h3>

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('student_name') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><font color="red">*</font><?php echo lang('clue_student_name'); ?></label>
                                        <div class="col-md-6">
                                            <input type="text" name="student_name" id="student_name" class="form-control" value="<?php echo set_value('student_name', isset($clue) ? $clue->student_name : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('student_name'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('student_nickname') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_student_nickname'); ?></label>
                                        <div class="col-md-6">
                                            <input type="text" name="student_nickname" id="student_nickname" class="form-control" value="<?php echo set_value('student_nickname', isset($clue) ? $clue->student_nickname : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('student_nickname'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('grade') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_grade'); ?></label>
                                        <div class="col-md-4">
                                            <select name="" id="grade" class="form-control" required="required">
                                                <?php foreach($this->config->item('comm.grade') as $key=>$value):?>
                                                    <option value="<?php echo $key;?>"><?php echo $value;?></option>
                                                <?php endforeach;?>
                                            </select>
                                            <span class="help-block"><?php echo form_error('grade'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('school') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_school'); ?></label>
                                        <div class="col-md-9">
                                            <input type="text" name="student_nickname" id="student_nickname" class="form-control" value="<?php echo set_value('school', isset($clue) ? $clue->school : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('school'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                             <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('phone') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><font color="red">*</font><?php echo lang('clue_phone'); ?></label>
                                        <div class="col-md-4">
                                            <input type="text" name="phone" id="phone" class="form-control" value="<?php echo set_value('phone', isset($clue) ? $clue->phone : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('phone'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('tel') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_tel'); ?></label>
                                        <div class="col-md-4">
                                            <input type="text" name="tel" id="tel" class="form-control" value="<?php echo set_value('tel', isset($clue) ? $clue->tel : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('tel'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('parent_name1') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_parent_name1'); ?></label>
                                        <div class="col-md-4">
                                            <input type="text" name="parent_name1" id="parent_name1" class="form-control" value="<?php echo set_value('parent_name1', isset($clue) ? $clue->parent_name1 : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('parent_name1'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('parent_phone1') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_parent_phone1'); ?></label>
                                        <div class="col-md-4">
                                            <input type="text" name="parent_phone1" id="parent_phone1" class="form-control" value="<?php echo set_value('parent_phone1', isset($clue) ? $clue->parent_phone1 : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('parent_phone1'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('parent_name2') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_parent_name2'); ?></label>
                                        <div class="col-md-4">
                                            <input type="text" name="parent_name2" id="parent_name2" class="form-control" value="<?php echo set_value('parent_name2', isset($clue) ? $clue->parent_name2 : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('parent_name2'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('parent_phone2') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_parent_phone2'); ?></label>
                                        <div class="col-md-4">
                                            <input type="text" name="parent_phone2" id="parent_phone2" class="form-control" value="<?php echo set_value('parent_phone2', isset($clue) ? $clue->parent_phone2 : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('parent_phone2'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('sex') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_sex'); ?></label>
                                        <div class="col-md-9">
                                            <div class="radio-list">
                                                <label class="radio-inline">
                                                <div class="radio"><span><input type="radio" name="sex" value="0"></span></div>
                                                <?php echo lang('clue_sex_male'); ?> </label>
                                                <label class="radio-inline">
                                                <div class="radio"><span class="checked"><input type="radio" name="sex" value="1" checked=""></span></div>
                                                <?php echo lang('clue_sex_female'); ?> </label>
                                            </div>
                                            <span class="help-block"><?php echo form_error('sex'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('address') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_address'); ?></label>
                                        <div class="col-md-9">
                                            <input type="text" name="address" id="address" class="form-control" value="<?php echo set_value('address', isset($clue) ? $clue->address : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('address'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('trade_wish') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><font color="red">*</font><?php echo lang('clue_trade_wish'); ?></label>
                                        <div class="col-md-4">
                                            <select name="trade_wish" id="trade_wish" class="form-control" >
                                                <?php foreach($this->config->item('comm.trade_wish') as $key=>$value):?>
                                                    <option value="<?php echo $key;?>" <?php echo set_select('clue_source', $key); ?>><?php echo $value;?></option>
                                                <?php endforeach;?>
                                            </select>
                                            <span class="help-block"><?php echo form_error('trade_wish'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('source') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_source'); ?></label>
                                        <div class="col-md-4">
                                            <select name="source" id="source" class="form-control" >
                                                <?php foreach($this->config->item('comm.clue_source') as $key=>$value):?>
                                                    <option value="<?php echo $key;?>" <?php echo set_select('source', $key); ?>><?php echo $value;?></option>
                                                <?php endforeach;?>
                                            </select>
                                            <span class="help-block"><?php echo form_error('source'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('from_big') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('from_big'); ?></label>
                                        <div class="col-md-6">
                                            <select name="from_big" id="from_big" class="form-control" >
                                                <?php foreach($this->config->item('comm.from_big') as $key=>$value):?>
                                                    <option value="<?php echo $key;?>" <?php echo set_select('from_big', $key); ?>><?php echo $value;?></option>
                                                <?php endforeach;?>
                                            </select>
                                            <span class="help-block"><?php echo form_error('from_big'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <h3 class="form-section"><?php echo lang('clue_other_info'); ?></h3>

                             <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('idcard') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_idcard'); ?></label>
                                        <div class="col-md-9">
                                            <input type="text" name="idcard" id="idcard" class="form-control" value="<?php echo set_value('idcard', isset($clue) ? $clue->idcard : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('idcard'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('birthday') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_birthday'); ?></label>
                                        <div class="col-md-5">
                                            <div class="input-group date date-picker">
                                                <input type="text" name="birthday" id="birthday" class="form-control" value="<?php echo set_value('birthday', isset($clue) ? $clue->birthday : ''); ?>" />
                                                <span class="input-group-btn">
                                                    <button class="btn default" type="button"><i class="fa fa-calendar"></i></button>
                                                </span>
                                            </div>
                                            <span class="help-block"><?php echo form_error('birthday'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('email') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('bf_email'); ?></label>
                                        <div class="col-md-9">
                                            <input type="text" name="email" id="email" class="form-control" value="<?php echo set_value('email', isset($clue) ? $clue->email : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('email'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('weibo') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_weibo'); ?></label>
                                        <div class="col-md-9">
                                            <input type="text" name="weibo" id="weibo" class="form-control" value="<?php echo set_value('weibo', isset($clue) ? $clue->weibo : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('weibo'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                             <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('qq') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_qq'); ?></label>
                                        <div class="col-md-9">
                                            <input type="text" name="qq" id="qq" class="form-control" value="<?php echo set_value('qq', isset($clue) ? $clue->qq : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('qq'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('weixin') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_weixin'); ?></label>
                                        <div class="col-md-9">
                                            <input type="text" name="weixin" id="weixin" class="form-control" value="<?php echo set_value('weixin', isset($clue) ? $clue->weixin : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('weixin'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>


                            <h3 class="form-section"><?php echo lang('clue_system_info'); ?></h3>

                             <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('consultant') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_consultant'); ?></label>
                                        <div class="col-md-9">
                                            <select name="consultant" id="consultant" class="form-control" >
                                                    <?php if (isset($consultants) && is_array($consultants) && count($consultants)) :?>
                                                        <?php foreach ($consultants as $consultant) :?>
                                                             <option value="<?php echo $consultant['id']; ?>">
                                                                <?php echo $consultant['nickname']; ?>
                                                            </option>
                                                        <?php endforeach; ?>
                                                        <option value="0">无</option>
                                                    <?php endif;?>
                                            </select>
                                            <span class="help-block"><?php echo form_error('consultant'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <!-- <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('promoter') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('clue_promoter'); ?></label>
                                        <div class="col-md-9">
                                            <select name="promoter" id="promoter" class="form-control" >
                                                <option value="0">无</option>
                                            </select>
                                            <span class="help-block"><?php echo form_error('promoter'); ?></span>
                                        </div>
                                    </div>
                                </div> -->
                            </div>
                        </div>

                        <div class="form-actions fluid">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="col-md-offset-3 col-md-9">
                                        <button type="submit" class="btn green" name="save"><?php echo lang('action_save');?></button>
                                        <a href="<?php echo site_url('/sale/clues');?>" class="btn default"><?php echo lang('action_cancel');?></a>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                </div>
                            </div>
                        </div>
                        <?php echo form_close(); ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<?php $this->load->view('footer');?>

<script>
    $(document).ready(function() {
        App.init(); // initlayout and core plugins
//        Clue.init();
    });
</script>

</body>
<!-- END BODY -->
</html>
